package design.simdi.code.final_paper.site.panels;

import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.IFeedbackMessageFilter;
import org.apache.wicket.markup.html.panel.FeedbackPanel;

/**
 * 
 * @author Marius Dumitriu - (Jun 26, 2010 - 11:22:41 PM)
 * 
 */
public class FeedBackPanels extends PagePanel {
	public static final String FEEDBACK_ERROR = "feedback.error";
	public static final String FEEDBACK_INFO = "feedback.info";
	public static final String FEEDBACK_WARN = "feedback.warn";
	private static final long serialVersionUID = 1L;

	public FeedBackPanels(String id) {
		super(id);
	}

	private FeedbackPanel feedback_error;
	private FeedbackPanel feedback_warn;
	private FeedbackPanel feedback_info;

	@Override
	public void panelInit() {
		feedback_error = new FeedbackPanel(FEEDBACK_ERROR, new IFeedbackMessageFilter() {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public boolean accept(FeedbackMessage message) {
				return message.getLevel() == FeedbackMessage.ERROR;
			}
		});
		feedback_warn = new FeedbackPanel(FEEDBACK_WARN, new IFeedbackMessageFilter() {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public boolean accept(FeedbackMessage message) {
				return message.getLevel() == FeedbackMessage.WARNING;
			}
		});
		feedback_info = new FeedbackPanel(FEEDBACK_INFO, new IFeedbackMessageFilter() {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public boolean accept(FeedbackMessage message) {
				return message.getLevel() == FeedbackMessage.INFO;
			}
		});

		feedback_error.setOutputMarkupPlaceholderTag(true);
		feedback_warn.setOutputMarkupPlaceholderTag(true);
		feedback_info.setOutputMarkupPlaceholderTag(true);

		add(feedback_error);
		add(feedback_warn);
		add(feedback_info);
	}

	/**
	 * @param feedback_error
	 *            the feedback_error to set
	 */
	public void setFeedback_error(FeedbackPanel feedback_error) {
		this.feedback_error = feedback_error;
	}

	/**
	 * @return the feedback_error
	 */
	public FeedbackPanel getFeedback_error() {
		return feedback_error;
	}

	/**
	 * @param feedback_warn
	 *            the feedback_warn to set
	 */
	public void setFeedback_warn(FeedbackPanel feedback_warn) {
		this.feedback_warn = feedback_warn;
	}

	/**
	 * @return the feedback_warn
	 */
	public FeedbackPanel getFeedback_warn() {
		return feedback_warn;
	}

	/**
	 * @param feedback_info
	 *            the feedback_info to set
	 */
	public void setFeedback_info(FeedbackPanel feedback_info) {
		this.feedback_info = feedback_info;
	}

	/**
	 * @return the feedback_info
	 */
	public FeedbackPanel getFeedback_info() {
		return feedback_info;
	}
}
